<?php
defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-type: text/html; charset=utf-8");
class Img extends CI_Controller {
    //头像处理
    function image(){
        ob_clean();
        $img = explode('.___', $_GET['imgurl']);
        $config['image_library'] = 'gd2';
        $config['source_image'] = FCPATH.$img[0];
        $config['maintain_ratio'] = TRUE;
        $config['dynamic_output'] = TRUE;
        $config['quality'] = 90;
        if ( $img[1] != 0 ){
            $config['width'] = $img[1];
        }
        if ( $img[2] != 0 ){
            $config['height'] = $img[2];
        }
        $this->load->library('image_lib', $config);
        if ( ! $this->image_lib->resize() ){
            echo $this->image_lib->display_errors();
        }
        $this->image_lib->clear();
    }
    function wx_img($c1,$c2){
//        $img = get_parameter('img', '', 'get');
            header('Content-type: image/jpeg');
            echo file_get_contents('http://mmbiz.qpic.cn/mmbiz/'.$c1.'/'.$c2);
//            echo file_get_contents('http://mmbiz.qpic.cn/mmbiz/a6iaILjL680Vw4bIJGleQeLXyxkL2hbLKQSCMYuwJ6yTTicvroiaibq2B0KibI6bhQHY5O9XCgrd66MuzAuE0zKIysQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=');
    }
    function wx_png_img($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('http://mmbiz.qpic.cn/mmbiz_png/'.$c1.'/'.$c2);
    }
    function wx_gif_img($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('http://mmbiz.qpic.cn/mmbiz_gif/'.$c1.'/'.$c2);
    }
    function wx_jpg_img($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('http://mmbiz.qpic.cn/mmbiz_jpg/'.$c1.'/'.$c2);
    }
    function wx_img_s($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('https://mmbiz.qpic.cn/mmbiz/'.$c1.'/'.$c2);
    }
    function wx_png_img_s($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('https://mmbiz.qpic.cn/mmbiz_png/'.$c1.'/'.$c2);
    }
    function wx_gif_img_s($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('https://mmbiz.qpic.cn/mmbiz_gif/'.$c1.'/'.$c2);
    }
    function wx_jpg_img_s($c1,$c2){
            header('Content-type: image/jpeg');
            echo file_get_contents('https://mmbiz.qpic.cn/mmbiz_jpg/'.$c1.'/'.$c2);
    }
}